
package ro.qi.framework.sys.security.entities;

import ro.qi.framework.sys.entities.Entity;


public class SecurityApplicationCollection extends Entity {

	public SecurityApplicationCollection() {
		super();
		select();
	}

	public int getCollectionSize() {
		return getCollectionSize("applications");
	}

	public int getId(int index) {
		return getCollectionIntValue("applications", "id", index);
	}

	public SecurityApplication getApplication(int index) {
		return new SecurityApplication(getId(index));
	}

//	private static final Vector categories = new Vector();
//	private static final Vector applications = new Vector();
//
//	static {
//		applications.add(new Application(0, "Global","Global", ""));
//		applications.add(new Application(2049, "Site Settings","Site Structure", "ro.qi.framework.web.site.structure.admin.SiteStructureAdmin"));
//		applications.add(new Application(2050, "Site Settings","Templates", "ro.qi.framework.web.templates.admin.TemplateAdmin"));
//		applications.add(new Application(2053, "Site Settings","Resources", "ro.qi.framework.web.resources.admin.ResourcesAdmin"));
//		applications.add(new Application(2000, "Site Layout","Site Layout", ""));
//		applications.add(new Application(2051, "Site Layout","Services", ""));
//		applications.add(new Application(2052, "Site Layout","Cofiguration", ""));
//		applications.add(new Application(2054, "Site Layout","Import / Export", "ro.qi.framework.web.site.importexport.admin.SiteImportExportAdmin"));
//		applications.add(new Application(5000, "Security","Accesses Management", ""));
//		applications.add(new Application(1301, "Content","Content", "ro.qi.framework.web.content.admin.ContentAdminPage"));
//		applications.add(new Application(1302, "Content","Ads Management", "ro.qi.framework.entities.marketing.ads.admin.AdsAdmin"));
//		applications.add(new Application(1303, "Content","Media Ads Management", "ro.qi.framework.entities.marketing.ads.admin.MediaAdsAdministrationPage"));
//		applications.add(new Application(1304, "Content","Database Query", "ro.qi.framework.entities.tools.database.query.DatabaseQuery"));
//		readCategories();
//	}
//
//	public static int getCollectionSize() {
//		return applications.size();
//	}
//
//	public static Application getApplicationById(int applicationId) {
//		for (int i = 0 ; i < getCollectionSize() ; i++) {
//			Application application = (Application)applications.get(i);
//			if (application.getId() == applicationId)
//				return application;
//		}
//		return null;
//	}
//
//	public static Application getApplicationByIndex(int index) {
//		return (Application)applications.get(index);
//	}
//
//	public static int getCategoryCollectionSize() {
//		return categories.size();
//	}
//
//	public static String getCategoryName(int index) {
//		if( index < getCategoryCollectionSize() )
//			return (String)categories.get(index);
//		return "";
//	}
//
//	private static void readCategories() {
//		for( int i = 0 ; i < applications.size() ; i++ ) {
//			Application application = (Application)applications.get(i);
//			if( application != null && application.getCategory() != null && !categories.contains(application.getCategory()) ) {
//				categories.add(application.getCategory());
//			}
//		}
//	}

}
